﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using TaobaoPick.taboao;
using System.Xml;
using TaobaoPick.storage;
using TaobaoPick;
namespace TestForm
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            /*
            TaobaoQueryParser parser = new TaobaoQueryParser();
            //XmlDocument doc = parser.processURL("http://search8.taobao.com/search?q=%EB%8A%B4%C5%A0t+&commend=all&ssid=s5-e&pid=mm_14507416_2297358_8935934");
            XmlDocument doc=parser.processfile("D:\\taobaopick\\sample2.html");
            textBox1.AppendText(doc.OuterXml);

            XmlNodeList nexts = doc.GetElementsByTagName("page-next");
            if (nexts.Count > 0)
            {
                foreach (XmlNode node in nexts)
                {
                    textBox1.Text = node.InnerText;
                }
            }

            //--->
            XmlNodeList list = doc.GetElementsByTagName("list-item");
            ItemManager itm = new ItemManager();
            foreach (XmlNode node in list)
            {
                itm.processItem(node);
            }
             **/

        }

        private void button2_Click(object sender, EventArgs e)
        {
            List<TaskTag> ll=TaobaoPick.TaoLogPageHelper.getValidTasks();
            taskComboBox.Items.Clear();
            taskComboBox.Tag = ll;
            foreach (TaskTag t in ll)
            {
                int idx=taskComboBox.Items.Add(t.tagName);
            }
        }

        private void button3_Click(object sender, EventArgs e)
        {
            int idx=taskComboBox.SelectedIndex;
            if(idx<0)
                return;
            List<TaskTag> ll = (List<TaskTag>)taskComboBox.Tag;
            if (ll == null)
                return;
            TaskTag tt=ll[idx];
            TaoLogPageHelper.processTaskPages(tt.taskId);
        }


    }
}
